  import {mapGetters} from 'vuex'
  export default {
    onShow(){
      this.setBadge()
    },
    computed:{
      ...mapGetters('m_cart',['total'])
    },
    watch:{
      total(){
        this.setBadge()
      }
    },
    methods:{
      
      setBadge(){
       
        if(this.total===0) 
        {
          uni.removeTabBarBadge({
            index:2
          })
          return 
        }
        uni.setTabBarBadge({
          index:2,
          text:this.total + ''
        })
      }
    }
    
  }